POV-Ray : Newsgroups : povray.general : Issue with function parameters : Re: Issue with function parameters Server Time
3 Aug 2024 18:17:13 EDT (-0400)
  Re: Issue with function parameters  
From: Thorsten Froehlich
Date: 13 Feb 2004 16:28:50
Message: <402d4192@news.povray.org>
In article <402d339c@news.povray.org> , Florian Brucker <tor### [at] torfboldcom>
wrote:

> in math.inc. With the current behaviour, I cannot use V, A, B, N, Mn,
> Mx, OMn and OMx as identifier names before including math.inc, because
> they are function parameters of functions declared in math.inc :(
> If the current behaviour is really necessary (and I doubt it is),

It is absolutely necessary.  What you expect is functions to have a scope on
the same level as macros do.  This is not the case, and you don't want it to
be the case either (it is possible to construct cases where, if this would
be the case, it would badly break functions - i.e. when generating a
function with macros).

The solution is that the include files should not use generic names for
function variable names.  A good solution would be to use all lower case
variable names with a prefix, i.e. "math__a" (note the *two* underscore
chars, this makes sure this will never be a keyword) instead of "A" in
math.inc .  This would work because the documentation already suggests to
the user to never use all lower case names.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.